' User Profile Routines (provided by the Microsoft Windows Kernel DLL)
'
Declare Function GetProfileInt Lib "Kernel" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal nDefault As Integer) As Integer
Declare Function GetProfileString Lib "Kernel" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer) As Integer
Declare Function WriteProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String) As Integer
Declare Function GetPrivateProfileInt Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Integer, ByVal lpFileName As String) As Integer
Declare Function GetPrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
Declare Function WritePrivateProfileString Lib "Kernel" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lplFileName As String) As Integer
Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
Declare Function GetSystemDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer
Const MAX_STRING_LEN = 255
Function Get_Profile_String (AppName$, KeyName$, KeyDefault$, KeyValue$) As Integer
'
' -- Get the profile entry specified, returning the string in KeyValue$ and the length
' of the string in the function name. If the profile entry is not found, then the
' default string is returned.
'
' Profile entries are generally stored in the WIN.INI file in the \WINDOWS directory
' and have the following format:
'
' [application name]
' ProfileEntry=Stringval
' :
' :
'
' Parameters:
' AppName$ Corresponds to the [application name]
' KeyName$ Name of the profile entry to retrieve (ProfileEntry)
' KeyDefault$ Value to be returned if profile entry cannot be retreived
' KeyValue$ Return value; stringval if located, KeyDefault$ if not found.
'
' Note:
' The maximum string length retreivable by this routine is set to MAX_STRING_LEN